<style lang="less">
  @import '../../styles/common.less';
</style>


<template>
  <div>
    <Button type="primary" size="large" @click="add">添加管理员</Button>
    <Table border :columns="columns" :data="data"></Table>
  </div>
</template>

<script>
    export default {
        name: "stduent-info",
        data(){
          return{
            columns: [
              {
                title: '编号',
                key: 'id'
              },
              {
                title: '账号',
                key: 'name'
              },
              {
                title: '角色名称',
                key: 'roleName'
              },
              {
                title: '操作',
                key: 'action',
                width: 180,
                align: 'center',
                render: (h, params) => {
                  return h('div', [
                    h('Button', {
                      props: {
                        type: 'primary',
                        size: 'small'
                      },
                      style: {
                        marginRight: '5px'
                      },
                      on: {
                        click: () => {
                          this.show(params.index)
                        }
                      }
                    }, '查看'),
                    h('Button', {
                      props: {
                        type: 'error',
                        size: 'small'
                      },
                      on: {
                        click: () => {
                          this.remove(params.index)
                        }
                      }
                    }, '删除')
                  ]);
                }
              }
            ],
            data: [
              {
                id:1,
                name:"admin",
                roleName:"超级管理员",
                telephone:"15858278946"
              }
            ]
          }
        },
        methods:{
          add(){
            this.$router.push({
              name: 'admin_mod'
            });
          },
          show (index) {
            this.$Modal.confirm({
              title: '审核信息',
              content: `账号：${this.data[index].name}<br>角色名称：${this.data[index].roleName}<br>手机号：${this.data[index].telephone}`
            })
          },
          remove (index) {
            this.data.splice(index, 1);
          }
        },
        mounted(){

        }
    }
</script>

<style scoped>

</style>
